Fix search preview editor mime type on JDK 27#9522
Conversation
mime types can't be set by String atm since the mime type injection hack doesn't work anymore. Set it by editor kit, similar other code does it (previews in bookmarks view, refactoring view. diffs etc).
974ee23 to
f5aa6ef
Compare
| initAndCheckEditorKitTypeRegistry("application/rtf", RTFEditorKit.class.getName()); //NOI18N | ||
|
|
||
| // Now hook up to the JDK's editor kit registry | ||
| // XXX: This all should be removed, see IZ #80110 | ||
| try { |
There was a problem hiding this comment.
The comment should probably also be copied to around here:
| initAndCheckEditorKitTypeRegistry("application/rtf", RTFEditorKit.class.getName()); //NOI18N | |
| // TODO AppContext and kitRegistryKey don't exist anymore in JDK 27+ | |
| // Now hook up to the JDK's editor kit registry | |
| // XXX: This all should be removed, see IZ #80110 | |
| try { |
There was a problem hiding this comment.
yeah you are right. i have put it on the uninstall code instead of the install code. But i think its fine we have to go through all AppContext usages anyway and get rid of them.
| // for (int i = 0; i < replacements.length; i++) { | ||
| // JEditorPane.registerEditorKitForContentType( | ||
| // replacements[i].contentType, | ||
| // replacements[i].newKitClassName, | ||
| // getClass().getClassLoader() | ||
| // ); | ||
| // } |
There was a problem hiding this comment.
This is the official and only JDK‑supported code path for JDK 27+.
There was a problem hiding this comment.
@ExE-Boss yes, it's also (as commented at #9523 (comment) ) not enough to replace what the current code is doing. We will have to come up with a registration strategy, or decide whether to remove this ability to pass in content types as a mime String to use NetBeans' editor kits. Personally, I think we might just mark this feature deprecated in the release notes for NB31.
mime types can't be set by String atm since the mime type injection hack doesn't work anymore. Set it by editor kit, similar other code does it (previews in bookmarks view, refactoring view. diffs etc - they all still work on JDK 27).
repro: use right click search and/or replace and look at preview, the editor should not be plain text
edit: this is for delivery, we can cleanup AppContext usages for NB 32 #9523